<?php
class Foto{
	
	public static function salvar($nomeASalvar){
		
		if(!empty($_FILES['foto']['tmp_name'])){
			$dadosFoto = file_get_contents($_FILES['foto']['tmp_name']);
				
			$foto = PhpThumbFactory::create($dadosFoto,array(),true);
			$foto->resize(80,80);
				
			$foto->save(APPLICATION_PATH. "/tmp/Fotos/".$nomeASalvar.".jpg" ,"JPG");
		}
				
	}
	
	public static function deletar($path){
		
		$arquivoExiste = file_exists($path);
		if ($arquivoExiste){
			unlink($path);
		}
		
	}
}